ply = player
function test(player)
    for _,v in pairs ( player.GetAll() ) do
       print( v:Nick().." = "..v:EndIndex() )
    end
end
concommand.Add("runit", test)
function switchtored(ply)
	if ply:Team() != 1 then
		ply:SetTeam(1)
	else
		print("Your already on the red team!")
	end
end
concommand.Add("red_team", switchtored)
function switchtoblue(ply)
	if ply:Team() != 2 then
		ply:SetTeam(2)
	else
		print("Your already on the blue team!")
	end
end
concommand.Add("blue_team", switchtoblue)

function TeamModels( ply )
	util.PrecacheModel( "models/player/odessa.mdl" )
	util.PrecacheModel( "models/player/odessa.mdl" )
	if ply:Team() == 1 then
		ply:SetModel( "models/player/phoenix.mdl" )
	elseif ply:Team() == 2 then
		ply:SetModel( "models/player/gign.mdl" )
	end
end 
hook.Add("PlayerSetModel", "TeamModels", TeamModels)

function ISaid( ply, text, toall )
	if (string.sub(text, 1, 4) == "/all") then//if the first 4 letters are /all continue
		if ply:IsAdmin() then
			return "[Global]"..string.sub( text, 5 );//add [Global] infront of the players text then display
		end
	end
	return text;//if its just a normal chat message, display normally
end
hook.Add( "PlayerSay", "ISaid", ISaid ); 
